00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _DECONNECTIONPROVIDER_HPP
00029 #define _DECONNECTIONPROVIDER_HPP
00030
00031 #include <WINDOWS.H>
00032
00033 #ifndef _DENET_HPP
00034 #include "deNet.hpp"
00035 #endif
00036
00037 #ifndef _DESYNCHOBJECT_HPP
00038 #include "deSynchObject.hpp"
00039 #endif
00040
00041 class deConnection;
00042 class deConnectionBin;
00043
00044 typedef class DENET_API deConnectionProvider
00045 {
00046 public:
00047
00048 deConnectionProvider(void);
00049 virtual ~deConnectionProvider(void);
00050
00051 eNetError AddConnectionToBins( deConnection * pConn );
00052 eNetError Init( DWORD dwFlags = NULL);
00053 eNetError Shutdown( DWORD dwFlags = NULL );
00054 eNetError CreateConnection( deConnection ** pOut, void * pProviderInfo = NULL, DWORD dwFlags = NULL );
00055 eNetError CloseConnection ( deConnection ** pConn, DWORD dwFlags = NULL );
00056
00057 WORD GetNumTotalConnectionBins(void);
00058 WORD GetNumProvidedConnectionBins(void);
00059 DWORD GetNumTotalConnections(void) const { return m_iNumTotalConnections; }
00060 DWORD GetNumProvidedConnections(void) const { return m_iNumConnections; }
00061 bool IsReady(void) const { return m_bReady; }
00062 deSynchObject * GetSynchObject(void) { return &m_SynchObject; }
00063
00064 virtual deConnection * GetConnectionAt( DWORD pIndex ) = 0;
00065
00066 protected:
00067
00068 virtual eNetError OnInit( DWORD dwFlags = NULL ) = 0;
00069 virtual eNetError OnShutdown( DWORD dwFlags = NULL ) = 0;
00070 virtual eNetError OnCreateConnection( deConnection ** pOut, void * pProviderInfo = NULL, DWORD dwFlags = NULL ) = 0;
00071 virtual eNetError OnCloseConnection ( deConnection ** pConn, DWORD dwFlags = NULL ) = 0;
00072
00073 virtual deConnectionBin * GetAvailableBin(void) = 0;
00074 virtual deConnection * GetUnusedConnection(void) = 0;
00075
00076 deConnectionBin * m_aConnectionBins;
00077 deConnection * m_aConnections;
00078 deSynchObject m_SynchObject;
00079
00080 private:
00081
00082 static DWORD m_iNumTotalConnections;
00083 DWORD m_iNumConnections;
00084 static WORD m_iNumTotalConnectionBins;
00085 WORD m_iNumConnectionBins;
00086 bool m_bReady;
00087
00088 } deConnectionProvider, *pdeConnectionProvider;
00089
00090 #endif